__author__ = 'Kerr Wang'

import struct
import time
import json
import asyncio
import http.client
import urllib
import logging

def httpSend(host, url, port, data_str):
#	conn = http.client.HTTPConnection(host, port)
	conn = http.client.HTTPConnection(host, port, timeout = 5)
#	headers = {"Content-type":"application/json"}

#	process data_str

	data = {'data':data_str}
#	print (data)
	headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "*/*"}
	params = urllib.parse.urlencode(data)
	conn.request("POST", url, params, headers)

	response = conn.getresponse()
	data = response.read()
	conn.close()
	return data






